/******************* (C) COPYRIGHT 2022 CHU WEI TENG ***********************************************
**
**------------------ File Info ---------------------------------------------------------------------
** File name:      dwin_label_gbk.c
** modified Date:  2022-05-10
** Last Version:   V1.0
** Descriptions: 
** 
**------------------ Modfication  log --------------------------------------------------------------
** Date       Who            Rev        Comments
----------------------------------------------------------------------------------------------------
   22/05/10  chuwt@qq.com    V1.00      created

****************************************************************************************************/
#include <string.h>
#include "dwin_label_gbk.h"
#include "dwin_trans.h"
#include "dwin_adapt.h"

/* Private define----------------------------------------------------------------------------------*/

/* Private typedef---------------------------------------------------------------------------------*/

/* Private variables-------------------------------------------------------------------------------*/
dwin_widget_vtable_t label_gbk_vt = 
{
    .obj_size =  sizeof(dwin_label_gbk_t),
};

/* public function---------------------------------------------------------------------------------*/
dwin_widget_t* dwin_label_gbk_create(dwin_widget_t* parent, uint16_t addr, uint16_t attr, uint16_t size)
{
    dwin_widget_t* label = NULL;

    if (size > GBK_MAX_CNT)
    {
        size = GBK_MAX_CNT;
    }
    label = dwin_widget_create(parent, &label_gbk_vt, size);

    if (label != NULL)
    {
        label->active = 1;
        label->addr = addr;
        label->attr = attr; 
        label->size = size;      
        label->widget_type = DWIN_LABEL_GBK;
    }
    return label;
}

ret_t dwin_label_gbk_write(dwin_widget_t* label)
{
    return dwin_widget_write(label);
}

ret_t dwin_multi_label_gbk_write(dwin_widget_t** label_arry, uint8_t count)
{
    return_value_if_fail(label_arry, RET_BAD_PARAMS);

    return dwin_multi_widget_write(label_arry, count);
}
